package cn.dface.app.deploy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PageController {
	
	@RequestMapping(value = {"", "/"})
	public String index() {
		return "redirect:/applications";
	}
	
	@RequestMapping(value = "/applications")
	public String getApplicationsPage() {
		return "index";
	}
	
	@RequestMapping(value = "applications/{name}")
	public String getApplicationPage(
			@PathVariable(value = "name") String name,
			ModelMap model) {
		model.addAttribute("appName", name);
		return "app";
	}
	
}
